<?php
//slider pause
$pause=ThemexCore::getOption('slider_pause',0);

//slider speed
$speed=ThemexCore::getOption('slider_speed',400);

//slider effect
$effect=ThemexCore::getOption('slider_type','fade');

//slide width
$width=ThemexCore::getOption('header_layout')=='fullwidth'?1120:824;

//query slides
$query=new WP_Query(array(
	'post_type' =>'slide',
	'showposts' => -1,
));

if($query->have_posts()) {
?>
<div class="main-slider-container fade-slider-container">
	<div class="fade-slider main-slider">
		<ul>
			<?php
			while($query->have_posts()) {
				$query->the_post(); 
				$link=get_post_meta($post->ID,'_slide_link',true);
				$out='';
				
				if(has_post_thumbnail()) {
					$out='<img src="'.themex_thumbnail($post->ID,$width).'" alt="'.get_the_title().'" />';
					if($link!='') {
						$out='<a href="'.$link.'">'.$out.'</a>';
					}
					
					if($post->post_content!='') {
						$out.='<div class="featured-image-caption visible-caption"><h4>'.get_the_content().'</h4></div>';
					}
				} else if(($video_code=get_post_meta($post->ID,'_slide_video',true))!='') {
					$out='<div class="embedded-video">'.html_entity_decode($video_code).'</div>';
				}
				
				if($out!='') {
					echo '<li>'.$out.'</li>';
				}				
			} 
			?>												
		</ul>
		<div class="arrow arrow-left fade-slider-arrow"></div>
		<div class="arrow arrow-right fade-slider-arrow"></div>
		<input type="hidden" class="slider-pause" value="<?php echo $pause; ?>" />
		<input type="hidden" class="slider-speed" value="<?php echo $speed; ?>" />
		<input type="hidden" class="slider-effect" value="<?php echo $effect; ?>" />
	</div>
	<div class="block-background layer-1"></div>
	<div class="block-background layer-2"></div>
</div><!-- main slider -->
<?php } ?>